server {
  listen 80;
  server_name {{ project.domain }} {{ project.domain | regex_replace('^www\\.', '') }};

  location / {
    return 301 https://$host$request_uri;
  }
}

server {
  listen 443 ssl;
  server_name {{ project.domain }} {{ project.domain | regex_replace('^www\\.', '') }};
  client_max_body_size 20m;
  ssl_certificate /etc/nginx/cert/{{ project.domain }}.pem;
  ssl_certificate_key /etc/nginx/cert/{{ project.domain }}.key;
  location / {
    root   {{ project.dir }}/{{ project.name }}/app;
    index  index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
}
  error_page   500 502 503 504  /50x.html;
  location = /50x.html {
  root   /usr/share/nginx/html;
}
location ~ \.php$ {
  root {{ project.dir }}/{{ project.name }}/app;
  fastcgi_pass php:9000;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;
}
}